]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Query stage for target actor instead of event.get_source()
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 25 Feb 2022 12:09:33 +0000 (13:09 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 4 Mar 2022 12:27:34 +0000 (12:27 +0000)
Events are going to stop containing the destinatary, so stop using this
API. Querying the stage is equivalent and ensured to be up-to-date.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>

js/ui/popupMenu.js

index 81ba02ce23d8972e2da2e09b961822a58b8004dd..4b51a7a9c88df4c80184c5b28db58de5df81c5da 100644 (file)
@@ -1396,6 +1396,8 @@ var PopupMenuManager = class {
 
     _onCapturedEvent(actor, event) {
         let menu = actor._delegate;
+        const targetActor = global.stage.get_event_actor(event);
+
         if (event.type() === Clutter.EventType.KEY_PRESS) {
             let symbol = event.get_key_symbol();
             if (symbol === Clutter.KEY_Down &&
@@ -1408,13 +1410,13 @@ var PopupMenuManager = class {
             }
         } else if (event.type() === Clutter.EventType.ENTER &&
                    (event.get_flags() & Clutter.EventFlags.GRAB_NOTIFY) === 0) {
-            let hoveredMenu = this._findMenuForSource(event.get_source());
+            let hoveredMenu = this._findMenuForSource(targetActor);
 
             if (hoveredMenu && hoveredMenu !== menu)
                 this._changeMenu(hoveredMenu);
         } else if ((event.type() === Clutter.EventType.BUTTON_PRESS ||
                     event.type() === Clutter.EventType.TOUCH_BEGIN) &&
-                   !actor.contains(event.get_source())) {
+                   !actor.contains(targetActor)) {
             menu.close(BoxPointer.PopupAnimation.FULL);
         }